//
//  BMHUpBaseController.m
//  BMHVideoMain
//
//  Created by shuihulu02 on 2017/3/27.
//  Copyright © 2017年 Baomihua. All rights reserved.
//

#import "BMHUpBaseController.h"

@interface BMHUpBaseController ()

@end

@implementation BMHUpBaseController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}


-(void)showHUDWithText:(NSString *)t detailsLabelText:(NSString *)d
{
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    hud.mode = MBProgressHUDModeText;
    hud.labelText =t;
    if (d) hud.detailsLabelText = d;
    hud.margin = 10.f;
    hud.yOffset = 150.f;
    
    hud.removeFromSuperViewOnHide = YES;
    [hud hide:YES afterDelay:1.0f];
}

-(void)showHUDLongWithText:(NSString *)t detailsLabelText:(NSString *)d
{
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    hud.mode = MBProgressHUDModeText;
    hud.labelText =t;
    if (d) hud.detailsLabelText = d;
    hud.margin = 10.f;
    hud.yOffset = 150.f;
    
    hud.removeFromSuperViewOnHide = YES;
    [hud hide:YES afterDelay:1.0f];
}

-(NSString*)convertToLocalTime:(NSUInteger)unixTime
{
    NSTimeInterval _interval=unixTime;
    NSDate *date = [NSDate dateWithTimeIntervalSince1970:_interval];
    NSDateFormatter *formatter= [[NSDateFormatter alloc] init];
    [formatter setLocale:[NSLocale currentLocale]];
    //[formatter setDateFormat:@"dd.MM.yyyy"];
    [formatter setDateFormat:@"yyyy.MM.dd"];
    return [formatter stringFromDate:date];
}

- (void)drawBorderWithButton:(UIView *)view {
    
    CALayer * downButtonLayer = [view layer];
    [downButtonLayer setMasksToBounds:YES];
    [downButtonLayer setBorderWidth:1.0];
    [downButtonLayer setBorderColor:[[UIColor grayColor] CGColor]];
}

-(void)showLoadingWithView:(UIView *)v
{
    _loadingView = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    _loadingView.mode = MBProgressHUDModeIndeterminate;
    
    //    _loadingView.margin = 10.f;
    //    _loadingView.yOffset = 150.f;
    _loadingView.labelText = LoadingUpload;
    _loadingView.removeFromSuperViewOnHide = YES;
    [_loadingView show:YES];
}

-(void)hiddenLoadingWihtView:(UIView *)v
{
    //[MBProgressHUD hideAllHUDsForView:v animated:YES];
    [MBProgressHUD hideHUDForView:v animated:YES];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
